<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vertical-align的取值</title>
  </head>
  <style>
    .box {
      background-color: pink;
      height: 300px;
      /* line-height: 300px; */
    }

    i {
      width: 100px;
      height: 100px;
      background-color: red;
      display: inline-block;
    }

    img {
      /* vertical-align: middle; */
      position: relative;
      top: 50%;
      left: 0;
      transform:translate(0,-50%)
    }
  </style>

  <body>
    <div class="box">
      <img src="../img/ysx.jpg" alt="" width="100">
      <span>spanxxx</span>
      <!-- <i>inline-block</i> -->
    </div>
  </body>

</html>